﻿/**
* 本文件用于调用geoserver切割的瓦片
* @author Wilson.Yan
* @version 2016.8.21
*/
//改变数字格式
function TileMongodbService(layerInfo) {
    var geoTiles = new Object;
    geoTiles.id = layerInfo.GUID;
    geoTiles.name = layerInfo.NAME;
    geoTiles.url = layerInfo.URL;
    geoTiles.wkid = layerInfo.hasOwnProperty("WKID") ? layerInfo.WKID : "3857";
    geoTiles.bbox = layerInfo.BBOX;
    geoTiles.miniresolution = layerInfo.hasOwnProperty("MINIRESOLUTION") ? layerInfo.MINIRESOLUTION : 0;
    geoTiles.maxresolution = layerInfo.hasOwnProperty("MAXRESOLUTION") ? layerInfo.MAXRESOLUTION : 19;
    geoTiles.minzoom = layerInfo.hasOwnProperty("MINZOOM") ? layerInfo.MINZOOM : 0;
    geoTiles.maxzoom = layerInfo.hasOwnProperty("MAXZOOM") ? layerInfo.MAXZOOM : 20;
    geoTiles.prj = layerInfo.PRJ;
    geoTiles.CreateLayer = function () {
        var id = this.id;

        var layers = viewer.imageryLayers;
        layerindex = layers._layers.length;
        var thisLayer = layers.addImageryProvider(new Cesium.UrlTemplateImageryProvider({
            url: this.url, //服务地址
            maximumLevel: this.maxzoom,
            minimumLevel: this.minzoom
        }));
        return thisLayer;
    };
    return geoTiles;
}